#define _CRT_SECURE_NO_WARNINGS 1
#include"Stack.h"
bool isValid(char* s) {
    ST st;
    STInit(&st);
    while (*s)
    {
        if (*s == '(' || *s == '[' || *s == '{')
        {
            STPush(&st, *s);
        }
        else
        {
            if (STEmpty(&st))
            {
                return false;
            }
            char ret = STTop(&st);
            STPop(&st);
            if ((*s == ')' && ret != '(')
                || (*s == ']' && ret != '[')
                || (*s == '}' && ret != '{'))
            {
                return false;
            }
        }
        s++;
    }
    bool ret = STEmpty(&st);
    STDestroy(&st);
    return ret;
}